package com.wit.zhenghao.day09;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

import org.junit.Test;

public class TestFileReader {

	@Test
	public void test1() throws FileNotFoundException , IOException {
		String file = "D:\\camp2018\\campzh\\zhenghao\\src\\day04\\Coder.java";
		FileReader reader = new FileReader(file);
		char[] chars = new char[10];
		int count = reader.read(chars);
		System.out.println(new String(chars));
	}
	@Test
	public void test2()  {
		String file = "D:\\camp2018\\campzh\\zhenghao\\src\\day03\\BubbleSort.java";
		List<String> lines = null;
		try {
			lines = Files.readAllLines(Paths.get(file));
		} catch (IOException e) {
			e.printStackTrace();
		}
		if(lines == null) return;
		for(String line : lines) {
			System.out.println(line);
		}
	}
}
